
package com.trydofor.id.byta;

/**
 * a meta with instance and byte size
 * 
 * @param <T> the instance type
 * @author : Shi Rongjiu (www.trydofor.com)
 */
public final class ByteMeta<T> {
    
    private final T   instance;
    private final int bytesize;
    
    /**
     * constructor
     * 
     * @param <T> the instance type
     * @param instance the instance
     * @param bytesize the byte-size of the instance
     * @return the meta
     */
    public static <T> ByteMeta<T> of(T instance, int bytesize) {
        return new ByteMeta<T>(instance, bytesize);
    }
    
    private ByteMeta(T instance, int bytesize) {
        this.instance = instance;
        this.bytesize = bytesize;
    }
    
    /**
     * @return the instance
     */
    public T instance() {
        return instance;
    }
    
    /**
     * @return the usedByte
     */
    public int byteSize() {
        return bytesize;
    }
}
